<?php
session_start();
require_once 'classes/Membership.php';
$membership = new Membership();

// If the user clicks the "Log Out" link on the index page.
if(isset($_GET['status']) && $_GET['status'] == 'loggedout') {
	$membership->log_User_Out();
}

// Did the user enter a password/username and click submit?
if($_POST && !empty($_POST['username']) && !empty($_POST['pwd'])) {
	$response = $membership->validate_User($_POST['username'], $_POST['pwd']);
}

//if($membership->isAuth())
{
  // header("location: index.php");
}
														
$page_name = login;
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <?php include('includes/head.php'); ?>
<body>
<div id="wrapper">
    <?php include('includes/header.php'); ?>
    <?php include('includes/menu.php'); ?>
    
    <div id="page">
        <div id="login">
            <form method="post" action="">
                <h2>Login <small>enter your credentials</small></h2>
                <p>
                    <label for="username">Username: </label>
                    <input type="text" name="username" />
                </p>
                
                <p>
                    <label for="pwd">Password: </label>
                    <input type="password" name="pwd" />
                </p>
                
                <p>
                    <input type="submit" id="submit" value="Login" name="submit" />
                </p>
            </form>
            <a href="register.php">Register a New Account</a>
            <?php if(isset($response)) echo "<h4 class='alert'>" . $response . "</h4>"; ?>
        </div><!--end login-->
    </div>
    <!-- end div#page -->
    <?php include('includes/footer.php'); ?>
</div> <!-- end div#wrapper -->
</body>
</html>
